package com.ddyx;

import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.Bean;
import org.springframework.web.client.RestTemplate;

/**
 * 程序主入口
 *      可以用SpringCloudApplication注解代替这里面的注解
 * @author agula
 * @date 2019-07-10 10:45
 */
@EnableFeignClients(basePackages = "com.ddyx.service.user.api.feign")
@EnableDiscoveryClient //服务发现 @EnableDiscoveryClient同时还可以作为Zookeeper、Consul中发现注解，作用范围更广一些。
@EnableEurekaClient //注册本服务到eureka-server中心
@MapperScan(basePackages = {"com.ddyx.service.user.app.system.mapper"})
@SpringBootApplication
public class UserApplication {

    public static void main(String[] args) {

        SpringApplication.run(UserApplication.class, args);
        System.out.println("***************  ddyx-user server start success  ***************");
    }


    @Bean
    @LoadBalanced //客户端负载均衡
    RestTemplate restTemplate() {
        return new RestTemplate();
    }
}
